Skip to content

allow customisation of some validation options#2

Merged
brandonkelly merged 3 commits into
mainfrom
feature/allow-customisation
Jul 6, 2026
Merged

allow customisation of some validation options#2
brandonkelly merged 3 commits into
mainfrom
feature/allow-customisation

Conversation

@i-just

@i-just i-just commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

Allow customisation of some validation options.

With this PR, you can pass an array as the second parameter to the UrlValidator constructor to customise some of the validation options. Customisable options are:

  • allowedSchemes
  • disallowedHostnames
  • disallowedIpv4Addresses
  • disallowedIpv4Ranges
  • ipv4FilterFlags (the FILTER_FLAG_IPV4 will always be added automatically)
  • ipv6FilterFlags (the FILTER_FLAG_IPV6 will always be added automatically)

This way, you can easily disallow the http scheme or allow for private IPs, e.g. when working with local URLs.

Related issues

n/a

@i-just i-just requested review from angrybrad and brandonkelly June 29, 2026 10:12
[ci skip]
@brandonkelly brandonkelly merged commit 31e6734 into main Jul 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants